/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.exam;

import java.util.Arrays;
import java.util.Random;

/**
 * <p>Project: javase - Ex3
 * <p>Powered by webrx On 2021-11-26 09:29:15
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex3 {
    public static void main(String[] args) {
        var rand = new Random();
        //red 1-33 6
        int[] redballs = new int[6]; //建立数组int[] 一维数组
        for (int i = 0; i < redballs.length; i++) {
            while (true) {
                int temp = rand.nextInt(33) + 1;
                boolean flag = true;
                for (int j = 0; j < redballs.length; j++) {
                    if (redballs[j] == temp) {
                        flag = false;
                    }
                }
                if (flag) {
                    redballs[i] = temp;
                    break;
                }
            }
        }
        Arrays.sort(redballs);
        System.out.print("红：");
        for (int b : redballs) {
            System.out.printf("%d ", b);
        }

        //blue 1-16 1
        int blueball = rand.nextInt(16) + 1;
        System.out.println(" 蓝：" + blueball);

    }
}
